package com.cai.servlet.user;

import com.cai.dao.UserDao;
import com.cai.dao.impl.UserDaoImpl;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;

/**
 * @author RuoLi
 */
@WebServlet(name = "ServletDelete", value = "/delete")
public class ServletDelete extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request, response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //获取参数
        String user = request.getParameter("user_user");
        UserDao userDao = new UserDaoImpl();
        int count = userDao.userDelete(user);
        if (count!=0){
            response.getWriter().println(1);
        }else {
            response.getWriter().println(0);
        }
    }
}
